home *** CD-ROM | disk | FTP | other *** search
- /* $VER: VModes 37.1 (21.2.93) */
- /* This program brings up a Buffer Modes Requester for AME */
-
- if show("l", "rexxarplib.library") = 0 then do
- check = addlib('rexxsupport.library', 0, -30, 0)
- check = addlib('rexxarplib.library', 0, -30, 0)
- end
-
- options results
-
- /*
- * The following sequence determines both AME's screen and port name,
- * and also gets the number screen rows and columns.
- */
-
- ameport = address()
- cols = ScreenCols(ameport)
- if cols == -1 then do
- amescreen = ""
- cols = ScreenCols()
- rows = ScreenRows()
- end
- else do
- amescreen = ameport
- rows = ScreenRows(amescreen)
- end
- /*
- * Set up a host. This time, send all messages to our own port.
- */
-
- address AREXX "'x = CreateHost(AMEPREFS, PREFSPORT, "amescreen")'"
- /*
- * Wait until it is ready.
- */
- do i = 1
- if showlist('p', AMEPREFS) ~= 0 then leave
- call delay 30
- end
-
- /*
- * Open the window
- */
-
- idcmp = 'CLOSEWINDOW+GADGETUP'
- flags = 'WINDOWCLOSE+WINDOWDRAG+WINDOWDEPTH+ACTIVATE'
-
- call OpenWindow(AMESEARCH, (cols - 640)/2, rows - 190, 480, 100, idcmp, ,
- flags, "Set Buffer Modes...")
-
- /*
- * Open the port that messages will come to
- */
- mp = openport(PREFSPORT)
-
-
- /* Read the current settings */
- template = "CMODE EXT MBYTE OVER READ TEMP WRAP"
- parse var template v.1 v.2 v.3 v.4 v.5 v.6 v.7
- 'getprefs' template
- parse var result p.1 p.2 p.3 p.4 p.5 p.6 p.7 .
-
-
- /*
- * Add the gadgets
- */
-
- call AddGadget(AMEPREFS, 50, 18, 1, " ", "%d")
- call AddGadget(AMEPREFS, 50, 36, 2, " ", "%d")
- call AddGadget(AMEPREFS, 50, 54, 3, " ", "%d")
-
- call AddGadget(AMEPREFS, 200, 18, 4, " ", "%d")
- call AddGadget(AMEPREFS, 200, 36, 5, " ", "%d")
-
- call AddGadget(AMEPREFS, 350, 18, 6, " ", "%d")
- call AddGadget(AMEPREFS, 350, 36, 7, " ", "%d")
-
-
- Call Move(AMEPREFS,80,24)
- Call Text(AMEPREFS,"CMODE")
- Call Move(AMEPREFS,80,42)
- Call Text(AMEPREFS,"External")
- Call Move(AMEPREFS,80,60)
- Call Text(AMEPREFS,"Multibyte")
-
- Call Move(AMEPREFS,230,24)
- Call Text(AMEPREFS,"Overwrite")
- Call Move(AMEPREFS,230,42)
- Call Text(AMEPREFS,"Read only")
-
- Call Move(AMEPREFS,380,24)
- Call Text(AMEPREFS,"Temp")
- Call Move(AMEPREFS,380,42)
- Call Text(AMEPREFS,"Wrap")
-
-
- call AddGadget(AMEPREFS, 50, 80, "USE", " OK ", "USE")
- call AddGadget(AMEPREFS,350, 80, "CLOSE", " Cancel ", "CANCEL")
-
- /*
- * set gadgets that should be on
- */
-
- do i = 1 to 7
- if(left(p.i,1,1)= 'N') then do
- res = SetGadget(AMEPREFS, i, "OFF")
- end
- else do
- res = SetGadget(AMEPREFS, i, "ON")
- end
- end
-
- /*
- * Main event loop
- */
- quitflag = 0
-
- do forever
- if quitflag = 1 then leave
- t = waitpkt(PREFSPORT)
- do forever
- p = getpkt(PREFSPORT)
- if c2d(p) = 0 then leave
- cmd = getarg(p)
- t = reply(p, 0)
-
- /* see what we got */
- if cmd = "CANCEL" then do
- call CloseWindow(AMEPREFS)
- quitflag = 1
- end
- else if cmd = "USE" | cmd = "CLOSEWINDOW" then do
- call CloseWindow(AMEPREFS)
- do i = 1 to 7
- if left(p.i,1,1) = 'N' then 'unsetprefs' v.i
- else 'setprefs' v.i
- end
- quitflag = 1
- end
- else if datatype(cmd, 'W') = 1 then do
- if left(p.cmd,1,1) = 'N' then do
- call SetGadget(AMEPREFS, cmd, "ON")
- p.cmd = 'O'
- end
- else do
- call SetGadget(AMEPREFS, cmd, "OFF")
- p.cmd = 'N'
- end
- end
- end
- end
- exit